<?php if(!IS_AJAX){?>
<include file="Public:header" />
<style>
.hiddentop {
	padding-top: 0 !important;
}
.PagesBox {
	text-align: center;
	overflow: hidden;
	width: 100%;
}
.panel-mission {
	margin: 10px 0;
	position: relative;
	box-shadow: 0px 1px 4px rgba(0,0,0,0.2);
	border-radius: 0;
	padding: 15px;
}
.panel-mission .formBox {
	/*height: 300px;*/
	overflow: auto;
}
.panel-mission .optionBtnBox {
	position: absolute;
	bottom: 0;
	width: 100%;
	left: 0;
	padding: 10px;
	background: white;
	text-align: right;
}
 
.formBox{ min-height:160px;}
.formBox.a {
	background: url(__PUBLIC__/a.png) no-repeat center center;
	background-size: 50% auto;
}
.formBox.p {
	background: url(__PUBLIC__/p.png) no-repeat center center;
	background-size: 50% auto;
}
 .checkoutform .form-inline{ position:relative; padding-left:10px;}
.checkoutform .checkbox-inline{ padding-top:9px;}
.checkoutform .form-inline .groupName{ min-width:80px; border-right:1px dotted; padding-right:5px;}
.checkoutform .form-inline:nth-child(2n){ background-color:rgba(0,0,0,0.25); color:#fff;}
.checkoutform .form-inline:nth-child(2n-1){ background-color:#fff;}
.groupName{border-right:none!important;}

</style>

<div class="row" style="margin-top:-15px;">
  <div class="col-sm-12" style="padding-top:0;">
        <div  class="panel affixelement" style="margin-bottom:15px;z-index:3;"  afftop="0" >
        	<div style="padding:15px">
                <div class="icheck">
                  <form action="<?php echo U('index');?>" id="ajaxlistboxform" class="affixelement" afftop="0" style="background:#fff; z-index:3;"  >
                      <input type="hidden" name="state" value="all">
                      <input type="hidden" name="type" value="1">
                      <input type="hidden" name="pagesize" id="pagesize"/>
                        
                      <div class="pull-left" style="line-height:34px; padding-top:5px;" id="missioncountbox"> </div>
                         
                        <div class="btn-group" style="padding-top:5px;">
                            <button data-toggle="dropdown" class="btn btn-default dropdown-toggle" type="button">选择时间<span class="caret"></span></button>
                            <ul role="menu" class="dropdown-menu">
                                <li style="white-space:nowrap" class="row">
                                    <div class="col-xs-12 text-center">
                                        <input class="form-control datepicker" id="starttime" name="starttime" readonly style="cursor:pointer; width:120px; display:inline;height:35px" value="<?php echo $sttime; ?>" placeholder="起始时间" type="text">
                                        至
                                        <input class="form-control datepicker" id="endtime" name="endtime" readonly style="cursor:pointer; width:120px; display:inline;" value="<?php echo $edtime; ?>" placeholder="结束时间" type="text">
                                    </div>
                                </li>
                            </ul>
                        </div>
                      
                        <div class="input-group" style="width:160px; padding-top:5px;">
                          <input type="text" name="keywords" value="<?php echo $keywords; ?>"  placeholder="文档名称或姓名" class="form-control">
                          <span class="input-group-btn">
                          	<button type="submit" class="btn btn-default"><i class="fa icon-search"></i></button>
                          </span> 
                        </div>
                         
                        <html:dropdownselect class="typeselect" selected="" name="type" style="height:30.99px; width:160px;margin-top:5px" multi="0" action="{:U('Team/form')}" title="选择表格分类"  placeholder="点击选择表格分类"  listloaded="listloaded" />
                        <div id="reselectlayout" style="top:0; display:none; left:0; bottom:0; right:0; position:fixed; z-index:4999;"></div>
                          
                          <!--   <a href="##" id="ajaxlistboxbob">批量操作</a>--> 
                        <div id="ajaxlistboxboc" style="display:none;"> <a href="##" class="btn btn-info" id="ajaxlistboxsa"> 全选 </a> <a href="##" class="btn btn-info" id="ajaxlistboxca"> 全不选 </a> <a href="##" class="btn btn-info" id="ajaxlistboxsar"> 反选 </a> <a rel="{:U('pass')}" href="##" class="btn btn-success"> 通过 </a> </div>
                                   
                        <!-- 右边 -->
                        <div class="btn-group pull-right" style="padding-top:5px;">
                            <button data-toggle="dropdown" class="btn btn-default dropdown-toggle" type="button"><i class="fa icon-th"></i>
                            <span class="caret"></span></button>
                            <ul id="listcheck" role="menu" class="dropdown-menu">
                                <li>
                                    <a onclick="location.href='{:U('index',['type'=>'0'])}'" href="javascript:void(0);">
                                        <i class="fa icon-list "></i> 列表视图
                                    </a>
                                </li>
                                <li>
                                    <a onclick="location.href='{:U('index',['type'=>'1'])}'" href="javascript:void(0);">
                                        <i class="fa icon-th"></i> 表格视图
                                    </a>
                                </li>
                            </ul>
                        </div>
                        
                        <!-- 右边结束 -->
                        <div style="float:none; clear:both;"></div>
                  </form>
                </div>
              </div>
          </div>
    </div>
    <form id="missioncountboxform" action="{:U('missioncount')}">
    </form>
  
  <div class="col-xs-12">
    <div class="panel">
      <div class="panel-heading">
      	<span class="pagetitle">我的文档</span>
        <select class="form-control pull-right" name="pagesize" style="margin-right:15px; width:auto;" onchange="$('#ajaxlistboxform').submit()">
            <option value="10" 
                            
            <eq name="pagesize" value="10">selected="selected"</eq>
            >每页10条 
                            
            </option>
            <option value="25" 
                            
            <eq name="pagesize" value="25">selected="selected"</eq>
            >每页25条
                            
            </option>
            <option value="50" 
                            
            <eq name="pagesize" value="50">selected="selected"</eq>
            >每页50条 
                            
            </option>
            <option value="100" 
                            
            <eq name="pagesize" value="100">selected="selected"</eq>
            >每页100条 
                            
            </option>
        </select>
        <div class="clearfix"></div>
      </div>
      <div class="panel-body" style="">
        <div  id="ajaxlistbox">
          <?php }?>
          <!-- 数据主体 -->
          <volist name="list" id="vo">
            <div class="col-md-6 col-lg-4 missionform" <eq name="key" value="0">data-position="left" data-intro="可以在这里查看与自己相关的审批和任务表格，领取的表格也会出现在这，点击下面的【发送】即可将表格发送给指定人员，当指定人员填写好表格提交后，会在【审批管理】界面生成一个审批文档供你审阅"</eq>>
              <div class="panel panel-mission">
                <div class="BatchOperation BatchOperationBtn">
                  <input class="checkbox" type="checkbox" name="id[]" value="{$vo.id}">
                  <i class="fa icon-check"></i>
                  <div class="fabg"></div>
                </div>
                <h4 class="panel-heading">{$vo.title} </h4>
                <div class="formBox <?php echo($vo['state']==0?'a':'') ?> <?php echo($vo['state']==3?'p':'') ?>" id="formBox-{$vo.id}">{:replacebr($vo['formtemplateText'])}</div>

                <h4 class="panel-heading">审批意见</h4>
                <p>由【{$vo.approvername}】审批</p>
                <div class="schedulebox" id="schedulebox-{$vo.id}">
                  <notempty name="vo['schedule']">
                    <volist name="vo['schedule']" id="s">
                      <p>意见：
                        <notempty name="s['comment']">{$s.comment}
                          <else/>
                          无
                        </notempty>
                        <eq name="s['status']" value="0"> 　<span class="label label-danger">驳回</span> </eq>
                        <eq name="s['status']" value="1"> 　<span class="label label-success">通过</span> </eq>
                        <gt name="s['sendParent']" value="0"><span class="label label-info">已递交上级</span></gt>
                      </p>

                      
                      <table class="table table-bordered" style="border:1px solid #ccc; margin-bottom:10px;">
                        <volist name="s['integrals']" id="rvo">
                          <tr>
                            <td>{$rvo.name} 【获得{$InteTypeList[$rvo['type']]} <span style="color:#f60; font-weight:bold; font-family:Cambria, 'Hoefler Text', 'Liberation Serif', Times, 'Times New Roman', serif;">{$rvo.num}</span>】</td>
                          </tr>
                        </volist>
                      </table>
                      <p></p>
                      <p>
                          <span class="pull-left">{:date('Y-m-d H:i:s', $s['datatime'])}</span><span class="pull-right">审批人：{$s.membername}</span>
                          <div class="clearfix"> </div>
                      </p>
                      <hr>
                    </volist>
                    <else/>
                    <div style="padding:5px; text-align:center;"> 暂无审批记录 </div>
                  </notempty>
                </div>


                  <?php if($vo['state']!=3&&$vo['state']!=0){ ?>
                <div class="optionBtnBox"> 
                   <a class="button" href="#window" onClick="_openWindow('{:U('mymissionread', array('id' => $vo['id']))}', 650, '{$vo.title}(修改)', '确认', null, '');"><i class="fa icon-edit"></i> 修改</a> 
                  &nbsp;
                  <eq name="vo['state']" value="-1"> 
                    <a class="button" href="javascript:void(0);" onClick="mission_send({$vo.id}, this);"><i class="fa icon-mail-forward"></i> 递交</a> </if>
                  </eq>
                   <a class="button" href="javascript:void(0);" title="发送给其他人" onClick="_openWindow('{:U('Mission/sendTo', array('id' => $vo['id']))}', 500, '{$vo.title}(发送表格)', '发送', null, '');"><i class="fa icon-exchange"></i> 发送</a> 
                  &nbsp;
                  <if condition="in_array($vo['state'], array(0,1,2))"> <a class="button" href="javascript:void(0);" onClick="mission_cancel({$vo.id}, this);"><i class="fa icon-download-alt"></i> 取消</a> </if>
                </div>
                <?php } ?>
              </div>
            </div>
          </volist>
          <!-- 数据主体结束 -->
          <?php if(!IS_AJAX){?>
        </div>
        <div class="loading hidden">正在加载</div>
        <div id="ajaxlistboxpages" class="PagesBox"><?php echo $pages;?></div>
      </div>
    </div>
  </div>
</div>
<include file="Public:script" />
<script src="__PUBLIC__/Js/jquery.masonry.min.js"></script> 
<script>
    function listloaded(){
        $('.typeselect').blur(function(){
            $("#ajaxlistboxform input[name='formcategory_id']").remove();
            if($('.typeselect.binded .itemspan').children("input:eq(1)").length!=0){
                $('#ajaxlistboxform').append("<input type='hidden' name='formcategory_id' value='"+$('.typeselect .itemspan').children("input:eq(1)").attr('value')+"'>");
            }
			 $('#masonrybox1').masonry('destroy').empty();
            $('#ajaxlistboxform').submit();
        });
    }

    $('.datepicker').datepicker({ dateFormat: 'yy-mm-dd' });
	$('#ajaxlistbox').ajaxlist({append:true,
		success:function(obj){
			$('.schedulebox').ajaxlist({autoload:false});
			//当数据成功获取的时候将表单转化为纯文
			/*$('.formBox .form-control').each(function(index, element) {
                var val = $(this).val();
				$(this).replaceWith('<span style="color:#f60;">'+val+'</span>');
            });
			//当数据成功获取的时候将选择集转化为纯文本
			$('.formBox .single-row').each(function(index, element) {
				if($(this).find(".checked").length==0){
					$(this).parent().remove();	
				}else{
					var input=$(this).find(".checked").removeAttr("class").parent().next();
					if(isNaN(Number(input.val()))){
						//input.attr("type","number").addClass('form-control').css('max-width','110px');
					}
				}
			});
			//当数据成功获取的时候将选择项转化为纯文本
			$('.formBox label.checkbox').each(function(index, element) {
                if($(this).find("input")[0].checked){
					$(".formBox hr").remove();
					var val=$(this).find("input").next().text();
					$(this).parent().replaceWith('<span>规则：</span><span style="color:#f60;">'+val+'</span>');
				}else{
					$(this).parent().remove();	
				};
				
            });*/
			var html = $('#ajaxlistbox').children();
			$newElems = html.appendTo('#masonrybox1');
			$newElems.imagesLoaded(function(){
				$('#masonrybox1').masonry( 'appended', $newElems, true);
				$(window).trigger('resize');
			});
	    }
	});

    $('.icheck input').change(function(){
        $('#ajaxlistboxform').submit();
    });
    $.cookie('loadIndexUrl', window.location.href, {path:'/'});
	$('#missioncountbox').ajaxlist();
    function mission_send(id,e){
		if(!confirm('确定递交吗？')){
			return false;
		}
		hideLayer();
		$.post("{:U('send')}", {id:id}, function(data){
			if(data.status == 1){
				updateList();
				$('#ajaxlistboxform').submit();
			}else{
				alert(data.info);
			}
		}, 'json');
	}
	function mission_cancel(id,e){
		if(!confirm('确定取消吗？')){
			return false;
		}
		hideLayer();
		$.post('{:U('cancel')}', {id:id}, function(data){
			if(data.status == 1){
				updateList();
				$('#ajaxlistboxform').submit();
			}else{
				alert(data.info);
			}
		}, 'json');
	}
	//切换状态
	function setstate(state){
		$('#ajaxlistboxform').find('input[name="state"]').val(state);
		$('#ajaxlistboxform').submit();
	}
	setTimeout(function(){
		$(window).trigger('resize').trigger('resize');
	},200);
</script>
</body></html><?php }?>